/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package intraverbal;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.beans.Beans;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.EntityManager;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;



public class Avaliacao extends javax.swing.JFrame {
    private int posicao = 0;
    public int indicePalavra = 0;
    List listaIdioma1 = new ArrayList();
    List listaIdioma2 = new ArrayList();
    int [] utilizado = new int[20];
    int [] incorreta = new int[20];
    String palavraCorreta;
    int dicasUtilizadas;
    int pulosUtilizados;
    Treino Treino1 = new Treino();
    int tentativas = 0;
    boolean utilizouDica = false;
    int fase = 1;
    static int idParticipante;
    int subFase = 1;
    int num;
    boolean repeteSubFase = false;
    java.sql.Date data_inicio;
    java.sql.Time hora_inicio;
    java.sql.Time hora_final;
    
    /**
     * Creates new form Avaliacao
     */
    public Avaliacao(int idPart)  {
        
        initComponents();
        idParticipante = idPart;
        data_inicio = new java.sql.Date(new java.util.Date().getTime());
        hora_inicio = new java.sql.Time(new java.util.Date().getTime());
        try {
            listaPalavras();
            obterPalavra();
        } 
        catch (SQLException ex) {
            Logger.getLogger(Avaliacao.class.getName()).log(Level.SEVERE, null, ex);
        }     
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jFormattedTextField1 = new javax.swing.JFormattedTextField();
        jFormattedTextField2 = new javax.swing.JFormattedTextField();
        jFormattedTextField3 = new javax.swing.JFormattedTextField();
        jFormattedTextField4 = new javax.swing.JFormattedTextField();
        jFormattedTextField5 = new javax.swing.JFormattedTextField();
        jFormattedTextField6 = new javax.swing.JFormattedTextField();
        jFormattedTextField7 = new javax.swing.JFormattedTextField();
        jFormattedTextField8 = new javax.swing.JFormattedTextField();
        jFormattedTextField9 = new javax.swing.JFormattedTextField();
        jFormattedTextField10 = new javax.swing.JFormattedTextField();
        jFormattedTextField11 = new javax.swing.JFormattedTextField();
        jFormattedTextField12 = new javax.swing.JFormattedTextField();
        jFormattedTextField13 = new javax.swing.JFormattedTextField();
        jFormattedTextField14 = new javax.swing.JFormattedTextField();
        jFormattedTextField15 = new javax.swing.JFormattedTextField();
        jFormattedTextField16 = new javax.swing.JFormattedTextField();
        BtnConferir = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Intraverbal ");
        setMaximumSize(new java.awt.Dimension(725, 500));
        setPreferredSize(new java.awt.Dimension(725, 500));
        setResizable(false);

        jTabbedPane1.setBackground(new java.awt.Color(153, 0, 0));
        jTabbedPane1.setFocusable(false);
        jTabbedPane1.setPreferredSize(new java.awt.Dimension(715, 460));

        jPanel1.setBackground(new java.awt.Color(153, 0, 0));
        jPanel1.setPreferredSize(new java.awt.Dimension(720, 500));

        jFormattedTextField1.setColumns(1);
        try {
            jFormattedTextField1.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField1.setText("");
        jFormattedTextField1.setToolTipText("");
        jFormattedTextField1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField1KeyReleased(evt);
            }
        });

        jFormattedTextField2.setColumns(1);
        try {
            jFormattedTextField2.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField2.setText("");
        jFormattedTextField2.setEnabled(false);
        jFormattedTextField2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField2.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField2KeyReleased(evt);
            }
        });

        jFormattedTextField3.setColumns(1);
        try {
            jFormattedTextField3.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField3.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField3.setText("");
        jFormattedTextField3.setEnabled(false);
        jFormattedTextField3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField3.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField3KeyReleased(evt);
            }
        });

        jFormattedTextField4.setColumns(1);
        try {
            jFormattedTextField4.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField4.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField4.setText("");
        jFormattedTextField4.setEnabled(false);
        jFormattedTextField4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField4.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField4KeyReleased(evt);
            }
        });

        jFormattedTextField5.setColumns(1);
        try {
            jFormattedTextField5.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField5.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField5.setText("");
        jFormattedTextField5.setEnabled(false);
        jFormattedTextField5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField5.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField5KeyReleased(evt);
            }
        });

        jFormattedTextField6.setColumns(1);
        try {
            jFormattedTextField6.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField6.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField6.setText("");
        jFormattedTextField6.setEnabled(false);
        jFormattedTextField6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField6.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField6KeyReleased(evt);
            }
        });

        jFormattedTextField7.setColumns(1);
        try {
            jFormattedTextField7.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField7.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField7.setText("");
        jFormattedTextField7.setEnabled(false);
        jFormattedTextField7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField7.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField7KeyReleased(evt);
            }
        });

        jFormattedTextField8.setColumns(1);
        try {
            jFormattedTextField8.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField8.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField8.setText("");
        jFormattedTextField8.setEnabled(false);
        jFormattedTextField8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField8.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField8KeyReleased(evt);
            }
        });

        jFormattedTextField9.setColumns(1);
        try {
            jFormattedTextField9.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField9.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField9.setText("");
        jFormattedTextField9.setEnabled(false);
        jFormattedTextField9.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField9.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField9KeyReleased(evt);
            }
        });

        jFormattedTextField10.setColumns(1);
        try {
            jFormattedTextField10.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField10.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField10.setText("");
        jFormattedTextField10.setEnabled(false);
        jFormattedTextField10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField10.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField10KeyReleased(evt);
            }
        });

        jFormattedTextField11.setColumns(1);
        try {
            jFormattedTextField11.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField11.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField11.setText("");
        jFormattedTextField11.setEnabled(false);
        jFormattedTextField11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField11.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField11KeyReleased(evt);
            }
        });

        jFormattedTextField12.setColumns(1);
        try {
            jFormattedTextField12.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField12.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField12.setText("");
        jFormattedTextField12.setEnabled(false);
        jFormattedTextField12.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField12.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField12KeyReleased(evt);
            }
        });

        jFormattedTextField13.setColumns(1);
        try {
            jFormattedTextField13.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField13.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField13.setText("");
        jFormattedTextField13.setEnabled(false);
        jFormattedTextField13.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField13.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField13KeyReleased(evt);
            }
        });

        jFormattedTextField14.setColumns(1);
        try {
            jFormattedTextField14.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField14.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField14.setText("");
        jFormattedTextField14.setEnabled(false);
        jFormattedTextField14.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField14.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField14KeyReleased(evt);
            }
        });

        jFormattedTextField15.setColumns(1);
        try {
            jFormattedTextField15.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("U")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField15.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField15.setText("");
        jFormattedTextField15.setEnabled(false);
        jFormattedTextField15.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jFormattedTextField15.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jFormattedTextField15KeyReleased(evt);
            }
        });

        jFormattedTextField16.setEditable(false);
        jFormattedTextField16.setColumns(1);
        try {
            jFormattedTextField16.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("UUUUUUUUUUUUUUUU")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedTextField16.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jFormattedTextField16.setFocusable(false);
        jFormattedTextField16.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N

        BtnConferir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/login.png"))); // NOI18N
        BtnConferir.setLabel("Próxima Palavra");
        BtnConferir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnConferirActionPerformed(evt);
            }
        });

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/dica.gif"))); // NOI18N
        jButton1.setText("Dica");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/seta.jpg"))); // NOI18N
        jButton2.setText("Pular Palavra");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jLabel1.setForeground(new java.awt.Color(240, 240, 240));
        jLabel1.setText("Treino 1");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(148, 148, 148)
                        .addComponent(jFormattedTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, 408, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(115, 115, 115)
                        .addComponent(jButton1)
                        .addGap(98, 98, 98)
                        .addComponent(jButton2)
                        .addGap(69, 69, 69)
                        .addComponent(BtnConferir))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jFormattedTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jFormattedTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(16, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(jLabel1)
                .addGap(40, 40, 40))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(55, 55, 55)
                .addComponent(jFormattedTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 107, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jFormattedTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFormattedTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFormattedTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFormattedTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFormattedTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFormattedTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFormattedTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFormattedTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFormattedTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFormattedTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFormattedTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFormattedTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFormattedTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFormattedTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFormattedTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(95, 95, 95)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(BtnConferir, javax.swing.GroupLayout.Alignment.TRAILING))
                .addGap(45, 45, 45)
                .addComponent(jLabel1)
                .addContainerGap())
        );

        BtnConferir.getAccessibleContext().setAccessibleName("conferir");

        jTabbedPane1.addTab("", jPanel1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 20, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 460, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 11, Short.MAX_VALUE))
        );

        jTabbedPane1.getAccessibleContext().setAccessibleName("Fase1");

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents
    private int getPalavrasUtilizadas(){
        int total = 0;
        for (int i =0; i < utilizado.length; i++)
        {
            if (utilizado[i] == 1)
            {
                total++;
            }
        }
        return total;
    }
    /** Ação do botão "Próxima Palavra" **/
    private void BtnConferirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnConferirActionPerformed
        //Tratamento para subFase=Teste                
        if(palavraCorreta.length()!=posicao && subFase == 2 && repeteSubFase == false)
            Treino1.palavrasIncorretas++;
                
        if(repeteSubFase == true)       
            Treino1.palavrasIncorretas--;
        
        if(getPalavrasUtilizadas() >= 20)
            novaSubFase();
        try {
            obterPalavra();
        } catch (SQLException ex) {
            Logger.getLogger(Avaliacao.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }//GEN-LAST:event_BtnConferirActionPerformed
        
    /** Ação do botão "Pular Palavra" **/
    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        
        //Pula a Palavra
        if (pulosUtilizados < Treino1.pulosPermitidos && Treino1.contadorPalavras<=20)
        { 
            pulosUtilizados++;
            if(repeteSubFase == false)
                Treino1.palavrasIncorretas++;
            incorreta[num] = 1;
            JOptionPane.showMessageDialog(rootPane,"Você pulou a palavra: " + palavraCorreta.toUpperCase()); 
            
            //Pulando a última palavra
            if(Treino1.contadorPalavras == 20)
                novaSubFase();

            try {
                obterPalavra();                                                                               
            } 
            catch (SQLException ex) {
                Logger.getLogger(Avaliacao.class.getName()).log(Level.SEVERE, null, ex);
                JOptionPane.showMessageDialog(rootPane,"Erro ao gerar nova palavra!"); 
            }  
        }
        else
        {
            if(pulosUtilizados >= Treino1.pulosPermitidos)
            {
                jButton2.setEnabled(false);
                JOptionPane.showMessageDialog(rootPane,"Pulos Esgotadas!");
            }            
        }                       
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jFormattedTextField1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField1KeyReleased
        if (!validaTecla(evt))
        {
            if(verificaLetra(posicao,jFormattedTextField1.getText().charAt(0)))
             {
                jFormattedTextField2.setEnabled(true);
                jFormattedTextField2.requestFocus();
                jFormattedTextField1.setEnabled(false);
                jFormattedTextField1.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             } 
             else{
                 jFormattedTextField1.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField1KeyReleased

    private void jFormattedTextField2KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField2KeyReleased
        if (!validaTecla(evt))
        {
            if(verificaLetra(posicao,jFormattedTextField2.getText().charAt(0)))
             {
                jFormattedTextField3.setEnabled(true);
                jFormattedTextField3.requestFocus();
                jFormattedTextField2.setEnabled(false);
                jFormattedTextField2.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             }  
            else{
                 jFormattedTextField2.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField2KeyReleased

    private void jFormattedTextField3KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField3KeyReleased
         if (!validaTecla(evt))
        {
            if(verificaLetra(posicao,jFormattedTextField3.getText().charAt(0)))
             {
                jFormattedTextField4.setEnabled(true);
                jFormattedTextField4.requestFocus();
                jFormattedTextField3.setEnabled(false);
                jFormattedTextField3.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             }  
            else{
                 jFormattedTextField3.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField3KeyReleased

    private void jFormattedTextField4KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField4KeyReleased
        if (!validaTecla(evt))
        {
            if(verificaLetra(posicao,jFormattedTextField4.getText().charAt(0)))
             {
                jFormattedTextField5.setEnabled(true);
                jFormattedTextField5.requestFocus();
                jFormattedTextField4.setEnabled(false);
                jFormattedTextField4.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             } 
            else{
                 jFormattedTextField4.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField4KeyReleased

    private void jFormattedTextField5KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField5KeyReleased
        if (!validaTecla(evt))
        {
            if(verificaLetra(posicao,jFormattedTextField5.getText().charAt(0)))
             {
                jFormattedTextField6.setEnabled(true);
                jFormattedTextField6.requestFocus();
                jFormattedTextField5.setEnabled(false);
                jFormattedTextField5.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             }
            else{
                 jFormattedTextField5.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField5KeyReleased

    private void jFormattedTextField6KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField6KeyReleased
        if (!validaTecla(evt))
        {
            if(verificaLetra(posicao,jFormattedTextField6.getText().charAt(0)))
             {
                jFormattedTextField7.setEnabled(true);
                jFormattedTextField7.requestFocus();
                jFormattedTextField6.setEnabled(false);
                jFormattedTextField6.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             }
            else{
                 jFormattedTextField6.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField6KeyReleased

    private void jFormattedTextField7KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField7KeyReleased
        if (!validaTecla(evt))
        {
            if(verificaLetra(posicao,jFormattedTextField7.getText().charAt(0)))
             {
                jFormattedTextField8.setEnabled(true);
                jFormattedTextField8.requestFocus();
                jFormattedTextField7.setEnabled(false);
                jFormattedTextField7.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             }
            else{
                 jFormattedTextField15.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField7KeyReleased

    private void jFormattedTextField8KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField8KeyReleased
        if (!validaTecla(evt))
        {
            if(verificaLetra(posicao,jFormattedTextField8.getText().charAt(0)))
             {
                jFormattedTextField9.setEnabled(true);
                jFormattedTextField9.requestFocus();
                jFormattedTextField8.setEnabled(false);
                jFormattedTextField8.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             }
            else{
                 jFormattedTextField8.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField8KeyReleased

    private void jFormattedTextField9KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField9KeyReleased
        if (!validaTecla(evt))
        {
            if(verificaLetra(posicao,jFormattedTextField9.getText().charAt(0)))
             {
                jFormattedTextField10.setEnabled(true);
                jFormattedTextField10.requestFocus();
                jFormattedTextField9.setEnabled(false);
                jFormattedTextField9.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             }
            else{
                 jFormattedTextField9.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField9KeyReleased

    private void jFormattedTextField10KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField10KeyReleased
        if (!validaTecla(evt))
        {
            if(verificaLetra(posicao,jFormattedTextField10.getText().charAt(0)))
             {
                jFormattedTextField11.setEnabled(true);
                jFormattedTextField11.requestFocus();
                jFormattedTextField10.setEnabled(false);
                jFormattedTextField10.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             }
            else{
                 jFormattedTextField10.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField10KeyReleased

    private void jFormattedTextField11KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField11KeyReleased
        if (!validaTecla(evt))
        {
            if(verificaLetra(posicao,jFormattedTextField11.getText().charAt(0)))
             {
                jFormattedTextField12.setEnabled(true);
                jFormattedTextField12.requestFocus();
                jFormattedTextField11.setEnabled(false);
                jFormattedTextField11.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             }
            else{
                 jFormattedTextField11.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField11KeyReleased

    private void jFormattedTextField12KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField12KeyReleased
        if (!validaTecla(evt))
        {  
            if(verificaLetra(posicao,jFormattedTextField12.getText().charAt(0)))
             {
                jFormattedTextField13.setEnabled(true);
                jFormattedTextField13.requestFocus();
                jFormattedTextField12.setEnabled(false);
                jFormattedTextField12.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             }
            else{
                 jFormattedTextField12.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField12KeyReleased

    private void jFormattedTextField13KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField13KeyReleased
        if (!validaTecla(evt))
        {
            if(verificaLetra(posicao,jFormattedTextField13.getText().charAt(0)))
             {
                jFormattedTextField14.setEnabled(true);
                jFormattedTextField14.requestFocus();
                jFormattedTextField13.setEnabled(false);
                jFormattedTextField13.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             }
            else{
                 jFormattedTextField13.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField13KeyReleased

    private void jFormattedTextField14KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField14KeyReleased
        if (!validaTecla(evt))
        {
            if(verificaLetra(posicao,jFormattedTextField14.getText().charAt(0)))
             {
                jFormattedTextField15.setEnabled(true);
                jFormattedTextField15.requestFocus();
                jFormattedTextField14.setEnabled(false);
                jFormattedTextField14.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             }
            else{
                 jFormattedTextField14.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField14KeyReleased

    private void jFormattedTextField15KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jFormattedTextField15KeyReleased
        if (!validaTecla(evt))
        {
            if(verificaLetra(posicao,jFormattedTextField15.getText().charAt(0)))
             {
                jFormattedTextField16.setEnabled(true);
                jFormattedTextField16.requestFocus();
                jFormattedTextField15.setEnabled(false);
                jFormattedTextField15.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.green));
             }
            else{
                 jFormattedTextField15.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
             }
        }
    }//GEN-LAST:event_jFormattedTextField15KeyReleased

    /** Função que valida a tecla apertada **/
    private boolean validaTecla (java.awt.event.KeyEvent evt)
    {
        boolean utilizada = false;
        
        if (BtnConferir.isEnabled())
        {
            return true;
        }
        
        //Executa DICA no F1
        if(evt.getKeyCode() == KeyEvent.VK_F1 && subFase != 2)
        {
            jButton1ActionPerformed(null);
            utilizada = true;
        }
        
        //Pula Palavra no SPACE
        if(evt.getKeyCode() == KeyEvent.VK_SPACE && subFase != 2)
        {
            jButton2ActionPerformed(null);
            utilizada = true;
        }
        
        //utiliza BACKSPACE
        if(evt.getKeyCode() == KeyEvent.VK_BACK_SPACE)        
            utilizada = true;
        
        
        return utilizada;
    }
    
    /** Ação do botão "Dica" **/
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        if (dicasUtilizadas < Treino1.dicasPermitidas)
        {
            JOptionPane.showMessageDialog(rootPane,palavraCorreta.toUpperCase().charAt(posicao));
            dicasUtilizadas++;
            utilizouDica = true;
        }
        else
        {
            jButton1.setEnabled(false);
            JOptionPane.showMessageDialog(rootPane,"Dicas Esgotadas!");
        }                   
    }//GEN-LAST:event_jButton1ActionPerformed
     
    /** Armazena as palavras nas listas **/    
  private void listaPalavras() throws SQLException
  {
        Conexao con = new Conexao();
        Connection con2 = con.conexao();
        Statement comando;
        ResultSet rs;
        int i;
        
        //Zera a lista de indices utilizados
        for(i=0; i<20; i++)
            utilizado[i] = 0;
                    
        //Busca no BD e armazena nas listas
        try
        {
            comando = con2.createStatement();
            rs = comando.executeQuery("SELECT COUNT(*) FROM palavra WHERE fase =" + fase); 
            rs.next();
            if (rs.getInt(1) < 20)
            {
                JOptionPane.showMessageDialog(rootPane,"Não há palavras suficientes cadastradas para a Fase " + fase);
            }
            else
            {
                comando = con2.createStatement();
                rs = comando.executeQuery("SELECT * FROM palavra WHERE fase =" + fase);          

                while (rs.next())
                {
                    listaIdioma1.add(rs.getString("idioma1"));
                    listaIdioma2.add(rs.getString("idioma2"));
                }  
            }
        }
        catch (SQLException ex)
        {
             Logger.getLogger(Avaliacao.class.getName()).log(Level.SEVERE, null, ex); 
             JOptionPane.showMessageDialog(rootPane,"Erro ao gerar lista de Palavras.");
        }            
  }
  private int getNumeroAvaliacao()
  {
      // todo
      return 1;
  }
  /** Função chamada ao fim de cada SubFase **/
  private void novaSubFase()
  {        
        hora_final = new java.sql.Time(new java.util.Date().getTime());
        Conexao con = new Conexao();        
        Connection con2 = con.conexao();
        PreparedStatement comando;
        try{
            comando = con2.prepareStatement(
                "INSERT INTO avaliacao(" +
                "id_participante, num_avaliacao, data, acertos, erros, dicas," +
                "pulos, hora_inicio, hora_fim, tipo, fase, subfase)" +
                "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
            );

            comando.setInt(1, idParticipante);//id_participante
            comando.setInt(2, getNumeroAvaliacao());//num_avaliacao
            comando.setDate(3, data_inicio);//data
            comando.setInt(4, Treino1.palavrasCorretas);//acertos
            comando.setInt(5, Treino1.palavrasIncorretas);//erros
            comando.setInt(6, dicasUtilizadas);//dicas
            comando.setInt(7, pulosUtilizados);//pulos
            comando.setTime(8, hora_inicio);//hora_inicio
            comando.setTime(9, hora_final);//hora_fim
            comando.setString(10, "");//tipo
            comando.setInt(11, fase);//fase
            comando.setInt(12, subFase);//subfase

            comando.execute();
        }
        catch (SQLException ex) {
            Logger.getLogger(ex.getMessage() + ex.getSQLState()).log(Level.SEVERE, null, ex);
        }
        
        Estatisticas est = new Estatisticas(dicasUtilizadas, pulosUtilizados, Treino1.palavrasCorretas,Treino1.palavrasIncorretas);                
        est.setVisible(true); 
        est.requestFocus();
        
        // Avalia se ocorre novaSubFase ou se Repete a SubFase
        if (Treino1.palavrasCorretas < 14 && subFase != 2)
            repetirSubFase();
        else
        {        
            //inicializa as variáveis para a nova SubFase
            zerarEstatisticas();
            repeteSubFase = false;

            for(int i = 0; i<20; i++)
                utilizado[i]=0;

            if(subFase == 3)
            {
                subFase = 1;     
                fase++;            
                try
                {
                    //Nova fase, gera nova lista de palavras
                    listaPalavras();                 
                }
                catch (SQLException ex) 
                {
                    Logger.getLogger(Avaliacao.class.getName()).log(Level.SEVERE, null, ex);
                    JOptionPane.showMessageDialog(rootPane,"Erro ao gerar nova lista de palavras!");
                }
            }
            else
            {           
                subFase++;
            }

            //Tratamentos quando subFase=Teste
             if(subFase == 2)
             {
                jButton1.setEnabled(false);
                jButton2.setEnabled(false);
                jButton1.setVisible(false);
                jButton2.setVisible(false);
                jPanel1.setBackground(Color.green);
                jLabel1.setText("Teste");
             }
            else
             {
                jButton1.setEnabled(true);
                jButton2.setEnabled(true);
                jButton1.setVisible(true);
                jButton2.setVisible(true);
                jPanel1.setBackground(Color.red);
                jLabel1.setText("Novo Treino1");

                if(subFase == 1)
                    jLabel1.setText("Treino1");
             }
        }
  }
  
     
    //Mostra a próxima palavra 
    private void obterPalavra() throws SQLException
    {  
        String palavra;
        Random rand = new Random();
        posicao = 0; 
        
        //Prepara a tela em seu estado inicial  
        jFormattedTextField1.setEnabled(true);
        jFormattedTextField1.setValue("");
        jFormattedTextField1.requestFocus(true);
        jFormattedTextField2.setValue("");
        jFormattedTextField3.setValue("");
        jFormattedTextField4.setValue("");
        jFormattedTextField5.setValue("");
        jFormattedTextField6.setValue("");
        jFormattedTextField7.setValue("");
        jFormattedTextField8.setValue("");
        jFormattedTextField9.setValue("");
        jFormattedTextField10.setValue("");
        jFormattedTextField11.setValue("");
        jFormattedTextField12.setValue("");
        jFormattedTextField13.setValue("");
        jFormattedTextField14.setValue("");
        jFormattedTextField15.setValue("");                
        jFormattedTextField2.setEnabled(false);
        jFormattedTextField3.setEnabled(false);
        jFormattedTextField4.setEnabled(false);
        jFormattedTextField5.setEnabled(false);
        jFormattedTextField6.setEnabled(false);
        jFormattedTextField7.setEnabled(false);
        jFormattedTextField8.setEnabled(false);
        jFormattedTextField9.setEnabled(false);
        jFormattedTextField10.setEnabled(false);
        jFormattedTextField11.setEnabled(false);
        jFormattedTextField12.setEnabled(false);
        jFormattedTextField13.setEnabled(false);
        jFormattedTextField14.setEnabled(false);
        jFormattedTextField15.setEnabled(false);
        jFormattedTextField1.setBorder(null);
        jFormattedTextField2.setBorder(null);
        jFormattedTextField3.setBorder(null);
        jFormattedTextField4.setBorder(null);
        jFormattedTextField5.setBorder(null);
        jFormattedTextField6.setBorder(null);
        jFormattedTextField7.setBorder(null);
        jFormattedTextField8.setBorder(null);
        jFormattedTextField9.setBorder(null);
        jFormattedTextField10.setBorder(null);
        jFormattedTextField11.setBorder(null);
        jFormattedTextField12.setBorder(null);
        jFormattedTextField13.setBorder(null);
        jFormattedTextField14.setBorder(null);
        jFormattedTextField15.setBorder(null);
        //Ajusta o estado dos botões        
        BtnConferir.setEnabled(false);
        jButton1.setEnabled(true);
        jButton2.setEnabled(true);               
                       
        //Gera um numero aleatorio [0-19]
        do{
            num = rand.nextInt(20);
        }while(utilizado[num]==1); 
                           
        //se subFase1 entao seleciona Idioma1
        if(subFase==1)
        {
            palavra =  listaIdioma1.get(num).toString();
            utilizado[num] = 1;
            palavraCorreta = listaIdioma2.get(num).toString();
        }
        //seleciona Idioma2
        else  
        {
            palavra =  listaIdioma2.get(num).toString();
            utilizado[num] = 1;
            palavraCorreta = listaIdioma1.get(num).toString();
        }
           
        //Seta a palavra no form                       
        jFormattedTextField16.setText(palavra);
        Treino1.contadorPalavras++;
    }
    
    /** Função que ajusta a SubFase para ser refeita **/
    private void repetirSubFase()
    {
        int i;
        repeteSubFase = true;
        Treino1.contadorPalavras = 20 - Treino1.palavrasIncorretas;
        
        
        //Repete a palavra considerada incorreta
        for (i = 0; i<20; i++)
        {
            if(incorreta[i]==1)
                utilizado[i] = 0;
        }
    }
    
    /** Função que veriica se a letra digitada está correta **/
    public boolean verificaLetra(int pos, char letraDigitada)
    {
        char letraCorreta;                   
        letraCorreta = palavraCorreta.toUpperCase().charAt(pos);
        
        if(letraCorreta == letraDigitada)
        {
            posicao++; 
            tentativas = 0;
            //Se acertar a ultima letra
            if(palavraCorreta.length()==posicao)
            {    
                //Avalia a utilização de Dicas
                if (utilizouDica && repeteSubFase == false)
                    Treino1.palavrasIncorretas++;
                else
                {
                    Treino1.palavrasCorretas++;
                    incorreta[num] = 0;
                }
                                               
                posicao = 0;
                
                //Mosta a msg para todas subfases != 2
                if(subFase !=2)
                    JOptionPane.showMessageDialog(rootPane,"Palavra Correta!");
               
                utilizouDica = false;                                
                
                //Ajusta o estado dos botões
                BtnConferir.setEnabled(true);
                jButton1.setEnabled(false);
                jButton2.setEnabled(false);                
            }
            return true;            
        }    
        else
        {
            //Tratamento para Subfase=Teste
            if(subFase==2)
            {
                BtnConferir.setEnabled(true);
                utilizouDica = true;
                return true;
            }
                
            //Mostra Dica se ocorrer muitos erros
            if (tentativas >= 5)
                jButton1ActionPerformed(null);
            tentativas++;
            return false;        
        }
    }
    
    private void zerarEstatisticas()
    {
        dicasUtilizadas = 0; 
        pulosUtilizados = 0; 
        Treino1.palavrasCorretas = 0;
        Treino1.palavrasIncorretas = 0;         
        Treino1.contadorPalavras = 0;
        
        for(int i = 0; i<20; i++)
        {
            utilizado[i] = 0;
            incorreta[i] = 0;
        }
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Avaliacao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Avaliacao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Avaliacao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Avaliacao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                    new Avaliacao(idParticipante).setVisible(true);                                         
                
            }
            
        });
        
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BtnConferir;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    public javax.swing.JFormattedTextField jFormattedTextField1;
    public javax.swing.JFormattedTextField jFormattedTextField10;
    public javax.swing.JFormattedTextField jFormattedTextField11;
    public javax.swing.JFormattedTextField jFormattedTextField12;
    public javax.swing.JFormattedTextField jFormattedTextField13;
    public javax.swing.JFormattedTextField jFormattedTextField14;
    public javax.swing.JFormattedTextField jFormattedTextField15;
    public javax.swing.JFormattedTextField jFormattedTextField16;
    public javax.swing.JFormattedTextField jFormattedTextField2;
    public javax.swing.JFormattedTextField jFormattedTextField3;
    public javax.swing.JFormattedTextField jFormattedTextField4;
    public javax.swing.JFormattedTextField jFormattedTextField5;
    public javax.swing.JFormattedTextField jFormattedTextField6;
    public javax.swing.JFormattedTextField jFormattedTextField7;
    public javax.swing.JFormattedTextField jFormattedTextField8;
    public javax.swing.JFormattedTextField jFormattedTextField9;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTabbedPane jTabbedPane1;
    // End of variables declaration//GEN-END:variables

}
